﻿using UnityEngine;

public class SkeletonDeadState:SkeletonStateBase
{
    public SkeletonDeadState(ControllerBase controller, StateMachineBase stateMachine, string stateName, string animatorParameter = null) 
        : base(controller, stateMachine, stateName, animatorParameter)
    {
    }

    public override void Enter()
    {
        base.Enter();
        SelfController.mRigidbody2D.AddForce(Vector2.one*(-SelfController.faceDir)*6, ForceMode2D.Impulse);
        SelfController.mCollider2D.enabled = false;
        SelfController.mAnimator.speed = 0;
        //TODO:掉落道具
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        if (stateDuration>0.3)
        {
            SelfController.gameObject.SetActive(false);     
        }
    }
}